import React from 'react'
import { connect } from 'react-redux'
import { push } from 'connected-react-router'
import { Table, Checkbox } from 'semantic-ui-react'
import { TableRow } from 'components/memberTable'

const ListTableRow = ({
  hasCheckBox, children, link, push,
}) => (
  <TableRow onClick={link ? () => push(link) : null} style={{ cursor: link ? 'pointer' : 'auto' }}>
    {hasCheckBox && (
      <Table.Cell collapsing>
        <Checkbox />
      </Table.Cell>
    )}
    {children}
  </TableRow>
)

const mapDispatchToProps = {
  push,
}

export default connect(
  null,
  mapDispatchToProps,
)(ListTableRow)
